package lyo.levelup.swing.hometask1;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.WindowConstants;

public class MainWindow extends JFrame
{
    private double x;
    private double y;
    private TextPanel tp;
    private ButtonComponents compBut;
    private double xNew, yNew;
    MainWindow()
    {        

    }

    public double getXcoord()
    {
        return xNew;
    }

    public double getYcoord()
    {
        return yNew;
    }

    public void setxNew(double xNew)
    {
        this.xNew = xNew;
    }

    public void setyNew(double yNew)
    {
        this.yNew = yNew;
    }

    private void configFrame()
    {
        tp = new TextPanel(xNew, yNew);
        compBut = new ButtonComponents();
        setTitle("My Frame");
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setSize(220, 220);
        setLocation((int) xNew, (int) yNew);
        JPanel mainPanel = new JPanel(new BorderLayout());
        mainPanel.add(tp,BorderLayout.NORTH);
        mainPanel.add(compBut,BorderLayout.SOUTH);
        add(mainPanel);
        setVisible(true);
    }

    public void drawFrame()
    {
        configFrame();
    }
}
